﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VideoClassLibrary.Model
{
    public enum PageMode
    {  Num = 0,
        Str = 1
    }

     public  class Pager
    {
          private int pageIndex= 0;
             private int recordCount  = 0;
             private int pageSize = 0;
             private int pageCount = 0;
             private string tableName= "";
             private string whereCondition = "";
             private string selectStr = "";
             private string order = "";
             private bool orderType   = true;
             private PageMode pageMode  = PageMode.Num;
 
             public Pager()
              {
             }
             private string keyfield = "id";
              /// <summary>
             ///搜索表或视图中的主键 如：ID
             /// </summary>
             public string KeyField
              {
                  get { return this.keyfield; }
                  set { this.keyfield = value; }
             }
             public int PageIndex
              {
                 get
                  {
                     return this.pageIndex;
                 }
                 set
                  {
                     this.pageIndex                    = value;
                 }
             }
 
             public PageMode PageMode
              {
                 get
                  {
                     return this.pageMode;
                 }
                 set
                  {
                     this.pageMode                = value;
                 }
             }
 
             public int PageCount
              {
                 get
                  {
                     return this.pageCount;
                 }
                 set
                  {
                     this.pageCount                    = value;
                 }
             }
 
              /// <summary>
             /// 总行数
             /// </summary>
             public int RecordCount
              {
                 get
                  {
                     return this.recordCount;
                 }
                 set
                  {
                     this.recordCount                = value;
                 }
             }
 
              /// <summary>
             /// 每页条数
             /// </summary>
             public int PageSize
              {
                 get
                  {
                     return this.pageSize;
                 }
                 set
                  {
                     this.pageSize                    = value;
                 }
             }
 
              /// <summary>
             /// 表名称
             /// </summary>
             public string TableName
              {
                 get
                  {
                     return tableName;
                 }
                 set
                  {
                     this.tableName                    = value;
                 }
             }
 
              /// <summary>
             /// 条件查询
             /// </summary>
             public string WhereCondition
              {
                 get
                  {
                     return whereCondition;
                 }
                 set
                  {
                     whereCondition = value;
                 }
             }
 
              /// <summary>
             /// 查询目标(搜索目标),比如:AddTime AS 时间,ID AS 编号
             /// </summary>
             public string SelectStr
              {
                 get
                  {
                     return selectStr;
                 }
                 set
                  {
                     selectStr= value;
                 }
             }
 
              /// <summary>
             /// 排序的列
             /// </summary>
             public string Order
              {
                 get
                  {
                     return order;
                 }
                 set
                  {
                     order = value;
                 }
             }
 
              /// <summary>
             /// 排序类型 true:asc false:desc
             /// </summary>
             public bool OrderType
              {
                 get
                  {
                     return orderType;
                 }
                 set
                  {
                     orderType = value;
                 }
             }
     
 //            /// <summary>
 //            /// 得到当前返回的数量
 //            /// </summary>
             //public int RowCount
             //{
             //    get
             //    {
             //        return this.rowCount;
             //    }
             //}
 
             private string groupby;
             public string Groupby
              {
                 get
                  {
                     return this.groupby;
                 }
                 set
                  {
                     this.groupby  = value;
                 }
             }
             //public string OutPager(string url)
             // {
             //    return Pager.OutPager(url);
             //}
 
         }
     }


